package com.tsd.common.service;

import com.tsd.common.entity.CommonFile;
import com.tsd.common.entity.CommonFileExt;
import com.tsd.core.vo.PageBean;
import com.tsd.system.entity.SysUser;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

/**
 * 描述：CommonFile服务实现层接口
 *
 * @author huawei
 * @date 2021/08/08 20:40:38
 */
public interface CommonFileService {

    /**
     * 描述：根据id获取CommonFile
     *
     * @param id
     */
    CommonFile getCommonFileById(Long id) throws Exception;

    /**
     * 描述：根据sid获取CommonFile
     *
     * @param sid
     */
    CommonFileExt queryBySid(String sid) throws Exception;

    CommonFileExt queryExcelTemplateByBizSid(String bizSid);

    /**
     * 描述：根据sid删除CommonFile
     *
     * @param list
     */
    void deleteCommonFiles(List<String> list, SysUser opUser) throws Exception;

    /**
     * 描述：保存或更新CommonFile
     *
     * @param record
     * @param opUser
     */
    void saveCommonFile(CommonFile record, SysUser opUser) throws Exception;

    /**
     * 描述：根据params分页查询CommonFile
     *
     * @param params
     * @param page
     */
    List<CommonFileExt> findCommonFiles(Map<String, Object> params, PageBean page) throws Exception;

    /**
     * 描述：根据params分页查询CommonFile
     *
     * @param params
     */
    List<CommonFileExt> findCommonFiles(Map<String, Object> params) throws Exception;

    CommonFileExt getFileInfoBySid(String sid) throws Exception;

    void deleteFileInfo4Notused(String ids, SysUser opUser) throws Exception;

    List<CommonFileExt> getCommonFilesBySidList(List<String> sidList) throws Exception;

    void saveAssociateData(CommonFile file) throws Exception;

    void updateAssociateData(String ids, String biz_table, String biz_sid, String biz_field_tag, Double lat, Double lng) throws Exception;

    void updateAssociateData(String file_sid, String biz_table, String biz_sid, String biz_field_tag) throws Exception;

    List<CommonFile> getFileInfoByBizSidAndBizTable(String associate_biz_sid, String associate_biz_table) throws Exception;

    void updateList(List<CommonFile> list) throws Exception;

    void updateDrBySid(String sid) throws Exception;

    /**
     * 根据文件生成icon文件
     *
     * @param sid
     * @param newWidth 为空时默认为100
     * @param opUser
     * @return
     * @throws Exception
     */
    CommonFile genIconFile(String sid, Integer newWidth, SysUser opUser) throws Exception;

    CommonFile addFileInfo4UE(HttpServletRequest request, MultipartFile upfile) throws Exception;

    CommonFile addBase64FileInfo4UE(HttpServletRequest request, String base64) throws Exception;

    void deleteCommonFile(SysUser opUser, String sid) throws Exception;
}
